#include "FilterUnitTests.h"

void Run_Filter_UnitTests_Test_1()
{
	printf("/*   Test: Run_Filter_UnitTests_Test_1               */\n");
	const UInt8 SensorFilterCoeffs[] = { 2u, 2u, 2u, 2u, 2u};
	Filter f(SensorFilterCoeffs);
	f.add(100);
	f.add(100);
	CheckResult(f.get() == 40);
}

void Run_Filter_UnitTests_Test_2()
{
	printf("/*   Test: Run_Filter_UnitTests_Test_2               */\n");
	const UInt8 SensorFilterCoeffs[] = { 2u, 2u, 2u, 2u, 2u};
	Filter f(SensorFilterCoeffs);
	f.add(100);
	f.add(100);
	f.add(100);
	f.add(100);
	f.add(100);
	CheckResult(f.get() == 100);
}

void Run_Filter_UnitTests_Test_3()
{
	printf("/*   Test: Run_Filter_UnitTests_Test_3               */\n");
	const UInt8 SensorFilterCoeffs[] = { 2u, 2u, 2u, 2u, 2u};
	Filter f(SensorFilterCoeffs);
	for(int i = 0; i< 91; i++)
	{
		f.add(73);
	}
	f.add(500);
	CheckResult(f.get() == 158);
}

void Run_Filter_UnitTests()
{
	Run_Filter_UnitTests_Test_1();
	Run_Filter_UnitTests_Test_2();
	Run_Filter_UnitTests_Test_3();
}


